import Vue from "vue"
import Vuex from "vuex"

Vue.use(Vuex)

// Vuex 数据持久化  存储localStorage 
// 引入插件
import createPersistedState from "vuex-persistedstate";

const store = new Vuex.Store({
  plugins: [createPersistedState()],
  modules: {

  },
  state: {
    userInfo: null,
    sp: [],
    goods: [],

  },
  mutations: {
    changeUserInfo(state, payload) {
      state.userInfo = payload
    },
    goodsUser(state, payload) {
      state.sp = payload
    },
    keywordUser(state, payload) {
      state.goods = payload
    }

  }

})

export default store;